home *** CD-ROM | disk | FTP | other *** search
- //
- // list.h - list interface using a nested class
- // with a static data member for counting the object
- //
-
- class list
- {
- public:
- list(unsigned n);
- ~list();
- void add(unsigned n);
- void print();
- static unsigned howmany();
- private:
- struct node
- {
- node(unsigned n, node *p);
- unsigned number;
- node *next;
- };
- node *first, *last;
- static unsigned count;
- };
-
- inline unsigned list::howmany()
- {
- return count;
- }
-
-